package com.bc.ui;

import com.bc.R;
import com.bc.service.SimpleRequestListener;
import com.bc.service.deal.MtGox.MtGoxService;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class TestActivity extends Activity {
	public MtGoxService mtGoxService;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_test);
		
		findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				loadMtGoxData();
			}
		});
	}
	
	public void loadMtGoxData() {
		if (mtGoxService == null) {
			mtGoxService = new MtGoxService(this);
		}

		mtGoxService.loadBtcData(new SimpleRequestListener(this){
			@Override
			public void onComplete(int errorCode) {
				((TextView)findViewById(R.id.tv_display)).setText(mtGoxService.getAllData());
			}
		});
	}
}
